const Router = require('koa-router');
const resultController = require('../controllers/resultController');
const authMiddleware = require('../middlewares/authMiddleware');

// 添加/api前缀
const router = new Router({ prefix: '/api' });

// 用户测评记录相关路由
router.post('/results', resultController.createResult); // 无需认证，允许未登录用户保存结果
router.get('/results/user', authMiddleware, resultController.getUserResults); // 需要认证，获取用户的所有结果
router.get('/results/:id', resultController.getResultById); // 无需认证，允许查看特定结果
router.delete('/results/:id', authMiddleware, resultController.deleteResult); // 需要认证，删除结果

module.exports = router;